@page "/presentation/getting-started"
@inject Microsoft.JSInterop.IJSRuntime JS
@using System.IO
@using Syncfusion.Blazor.Buttons
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment
@using BlazorDemos.Data.FileFormats.Presentation
@inherits SampleBaseComponent;

<SampleDescription>
    <p style="font-size:16px">This sample demonstrates how to create slides with simple text in a PowerPoint presentation.</p>
</SampleDescription>
<ActionDescription>
  <b style="font-size:16px">Features:</b>
    <br />    
    <ul style="font-size:16px">
		    <li>Create a PowerPoint presentation from scratch with few lines of code.</li>
            <li>Open the existing PowerPoint presentation from file system or stream, modify and save it back.</li>
            <li>Save the PowerPoint presentation to a local file, stream, or stream it to the client browser.</li>
            <li>Create and edit shapes.</li>
			<li>Create and edit text.</li>
			<li>Add and manipulate single-level and multilevel lists equivalent to Microsoft PowerPoint.</li>
			<li>Create, edit and convert charts.</li>
			<li>Create and edit SmartArt diagrams.</li>
			<li>Create and edit tables with different styles.</li>
			<li>Copy and paste PowerPoint slides with source and destination paste options</li>
			<li>Create, reply and edit comments.</li>
			<li>Create and edit notes pages.</li>
			<li>Apply and edit formatting of slide elements.</li>
    </ul>
    <br /> 
</ActionDescription>

<div class="control-section">
    <p style="font-size:16px">Click the button to view a PowerPoint presentation generated by Essential Presentation. Please note that Microsoft PowerPoint viewer or its equivalent is required to view the resultant document.</p>
        
    <div class="button-section">
        <div id="button-control">
            <div class="row">
                <div>
                    <SfButton @onclick="CreatePresentation">Create Presentation</SfButton>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .control-section .row {
        margin: 10px 0;
    }
</style>

@code {
    MemoryStream documentStream;    

    /// <summary>
    /// Create and download the Presentation document
    /// </summary>
    public async Task CreatePresentation(MouseEventArgs args)
    {
        GettingStartedService service = new GettingStartedService(hostingEnvironment);
        documentStream = service.CreatePresentation();
        await JS.SaveAs("Sample.pptx", documentStream.ToArray());       
    }
}